package com.example.lopngoaingu;

import tttrung43.libs.android.DBAdapter;
import android.app.Activity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.webkit.WebView;

public class ContentActivity extends Activity {

	private WebView web;
	private DBAdapter conn;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.content_layout);
		web = (WebView) findViewById(R.id.web);
		conn = new DBAdapter(this);
		SQLiteDatabase db = conn.getReadableDatabase();
		Cursor result = db.rawQuery(
				"select tieude, noidung from truyen where id=1", null);
		result.moveToFirst();
		String data = "<h2><span style='color: #003399 ;'>"
				+ result.getString(0) + "</h2>" + result.getString(1);
		web.loadDataWithBaseURL(null, data, "text/html", "utf-8", null);
		result.close();
		db.close();
		conn.close();
	}
}
